<template>
  <div class="father">
    <h3>父组件</h3>
    <div class="content">
      <Category title="热门游戏列表">
        <!-- 具名插槽 -->
        <template v-slot:s2>
          <ul>
            <li v-for="g in games" :key="g.id">{{ g.name }}</li>
          </ul>
        </template>
        <template v-slot:s1> <h2>热门游戏列表</h2> </template>
      </Category>
      <!-- 具名插槽，#s1 为 语法糖 -->
      <Category #s1 title="今日美食城市">
        <img :src="imgUrl" alt="" />
      </Category>
      <!-- 非具名插槽，没有名字的插槽默认的名字是 default -->
      <Category title="今日影视推荐">
        <video :src="videoUrl" controls></video>
      </Category>
    </div>
  </div>
</template>
<script setup lang="ts" name="Father">
import Category from './Category.vue'
import { ref, reactive } from 'vue'

let games = reactive([
  { id: 'asgytdfats01', name: '英雄联盟' },
  { id: 'asgytdfats02', name: '王者农药' },
  { id: 'asgytdfats03', name: '红色警戒' },
  { id: 'asgytdfats04', name: '斗罗大陆' },
])
let imgUrl = ref('https://z1.ax1x.com/2023/11/19/piNxLo4.jpg')
let videoUrl = ref(
  'https://msn1.go2yd.com/video/cc917a5ff6b28486c1d1b49992334a68.mp4_hd.mp4?auth_id=2b&auth_key=b861a3705e2981e0841955b4911aa15f&timestamp=1751118487',
)
</script>

<style scoped>
.father {
  background-color: rgb(165, 164, 164);
  padding: 20px;
  border-radius: 10px;
}
.content {
  display: flex;
  justify-content: space-evenly;
}
img,
video {
  width: 100%;
}
</style>
